/*
 * Copyright 2000-2020 ALPHA LAB.Inc All Rights Reserved.
 */
package com.alphalab.moonlight.demo.impl.role;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 
import com.alphalab.framework.role.GeneralRole;
import com.alphalab.moonlight.demo.dao.model.Airline;
import com.alphalab.moonlight.demo.dao.service.IAirlineDao;
import com.alphalab.moonlight.demo.impl.trans.AirlineTransfer;
import com.alphalab.moonlight.demo.service.model.AirlineVO;
import com.alphalab.moonlight.demo.service.role.IAirlineRole;

/**
 * AirlineRole.
 * @author allen 
 * @version 1.0.0 2018年2月20日
 */
@Service 
@Transactional
public class AirlineRole extends GeneralRole<AirlineVO, Airline, IAirlineDao, AirlineTransfer> 
	implements IAirlineRole {
	
	/**
	 * 初始化时注入airlineDao到AirlineRole中.
	 * @param airlineDao airlineDao
	 */  
	@Autowired
	public void setAirlineDao(final IAirlineDao airlineDao) {
		super.setEntityDao(airlineDao);
	}
	
	/**
	 * 手动new一个转换器并set到父类中.
	 */
	@Override
	public AirlineTransfer getEntityTransfer() {
		try {
			return super.getEntityTransfer();
		} catch (RuntimeException e) { 
			super.setEntityTransfer(new AirlineTransfer());
		}
		return super.getEntityTransfer();
	}
	
}
